/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.vce.election.web;

import com.vce.election.domain.Town;
import com.vce.web.SearchManagedBean;

/**
 *
 * @author Ggutierrez
 */
public class SearchJrvBean extends SearchManagedBean{
    private Town town;
    private String code;

    public SearchJrvBean() {
    }
    
    @Override
    public void reset(){
        super.reset();
    }
    
    public String init(){
        reset();
        return "success";
    }
    
    public String execute(){
        setResults(getElection().findTowns());
        if (getResults() == null || getResults().isEmpty()){
            addErrorMessage("No records found.");
            return "fail";
        } else {
            return "success";}
    }

    public Town getTown() {
        return town;
    }

    public void setTown(Town town) {
        this.town = town;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

}
